package org.dant.ant.extension.xml;

import java.io.*;
import java.net.URL;

import org.apache.tools.ant.Task;
import org.apache.tools.ant.util.JAXPUtils;

public class AggregateTransformer extends org.apache.tools.ant.taskdefs.optional.junit.AggregateTransformer {
    public AggregateTransformer(Task task) {
        super(task);
    }

    protected String getStylesheetSystemId() throws IOException {
        String xslname = "dant-frames.xsl";
        if (NOFRAMES.equals(format)) {
            xslname = "dant-frames.xsl";
            System.out.println("We are not support NOFRAME format");
        }
        if (styleDir == null) {
            URL url = getClass().getResource(xslname);
            if (url == null) {
                throw new FileNotFoundException("Could not find jar resource " + xslname);
            }
            return url.toExternalForm();
        }
        File file = new File(styleDir, xslname);

        if (!file.exists()) {
            throw new FileNotFoundException("Could not find file '" + file + "'");
        }
        return JAXPUtils.getSystemId(file);
    }
}
